<?php

namespace app\adminapi\controller\card;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\card\CardSettingLists;
use app\adminapi\logic\card\CardSettingLogic;
use app\adminapi\validate\card\CardSettingValidate;


/**
 * card控制器
 * Class CardSettingController
 * @package app\adminapi\controller\card
 */
class CardSettingController extends BaseAdminController
{

    /**
     * @notes 获取card模版列表
     * @return \think\response\Json
     */
    public function lists()
    {
        return $this->dataLists(new CardSettingLists());
    }


    /**
     * @notes 添加card
     * @return \think\response\Json
     * @author likeadmin
     * @date 2025/04/10 14:23
     */
    public function add()
    {
        $params = (new CardSettingValidate())->post()->goCheck('add');
        $result = CardSettingLogic::add($params);
        if (true === $result) {
            return $this->success('添加成功', [], 1, 1);
        }
        return $this->fail(CardSettingLogic::getError());
    }


    /**
     * @notes 编辑card
     * @return \think\response\Json
     * @author likeadmin
     * @date 2025/04/10 14:23
     */
    public function edit()
    {
        $params = (new CardSettingValidate())->post()->goCheck('edit');
        $result = CardSettingLogic::edit($params);
        if (true === $result) {
            return $this->success('编辑成功', [], 1, 1);
        }
        return $this->fail(CardSettingLogic::getError());
    }


    /**
     * @notes 删除card
     * @return \think\response\Json
     * @author likeadmin
     * @date 2025/04/10 14:23
     */
    public function delete()
    {
        return $this->fail('暂不支持删除');
        $params = (new CardSettingValidate())->post()->goCheck('delete');
        CardSettingLogic::delete($params);
        return $this->success('删除成功', [], 1, 1);
    }


    /**
     * @notes 获取card详情
     * @return \think\response\Json
     * @author likeadmin
     * @date 2025/04/10 14:23
     */
    public function detail()
    {
        $params = (new CardSettingValidate())->goCheck('detail');
        $result = CardSettingLogic::detail($params);
        return $this->data($result);
    }


}